//
//  SingleGoodsTableViewCell.swift
//  ZNZXSuperMarket
//
//  Created by 四川中农 on 2018/8/7.
//  Copyright © 2018年 四川中农. All rights reserved.
//

import UIKit

class SingleGoodsTableViewCell: UITableViewCell {
    
    @IBOutlet weak var goodsImage: UIImageView!
    @IBOutlet weak var goodsName: UILabel!
    @IBOutlet weak var timeLabel: UILabel!
    @IBOutlet weak var goodsCount: UILabel!

    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }
    
    func reload(withGoodsImage img:String,name:String,startTime:String,endTime:String,array:[ListModel]){
        self.goodsName.text = name
        self.goodsImage.my_setImage(url: img, placeholder: Api.placeHolder.rawValue)
        let str = "统计时段：" + startTime + "至" + endTime
        var attribetuString = NSMutableAttributedString.init(string: str)
        attribetuString.addAttributes([NSAttributedStringKey.foregroundColor:UIColor.init(hexColor: "#333333")], range: NSString.init(string: str).range(of: startTime))
        attribetuString = NSMutableAttributedString.init(attributedString: attribetuString)
        attribetuString.addAttributes([NSAttributedStringKey.foregroundColor:UIColor.init(hexColor: "#333333")], range: NSString.init(string: str).range(of: endTime))
        self.timeLabel.attributedText = attribetuString
        self.goodsCount.text = "共\(array.count)条记录"
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
